In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Psst... Ruszyły zawody olimpiady informatycznej dla uczniów szkół podstawowych i średnich. Zadania na tych konkursach są bardzo podobne do zadań, które rozwiązujesz, tutaj, na Szkopule. Zobacz więcej:
- dla uczniów szkół podstawowych: oij.edu.pl/start/
- dla uczniów szkół średnich: oi.edu.pl/l/jak_zaczac/
After quite a lot of effort Bytie has finally managed to put rooks
on a board of size so that no two of them attack each other.
A quick reminder: a rook attacks all the fields of the board that
are located in the same row or in the same column as it is1.
Unfortunately, the boy has now accidentally hit the board.
As a result, several rooks have fallen down from it.
Could you help Bytie put these rooks back on the board?
The boy would like to leave the rooks that are still on the board intact.
Input
The first line of the standard input contains one integer
() that represents the size of the board.
A description of the configuration of the rooks follows:
the following lines contain characters each.
The character '.' represents an empty field whereas
the letter 'W' represents a field occupied by a rook.
You can assume that there are rooks on the board with
and that no pair of rooks on the board attacks each other.
Output
Your program should write to the standard output lines containing
characters '.' or 'W' each: the final configuration of rooks on the board.
The description should contain exactly occurrences of the letter 'W'
with rooks placed in the same positions as in the initial board.
No two rooks may attack each other.
If there are multiple ways of placing rooks on the initial board, your program should output
any one of them.